package net.gdface.sdk;

public class RectUtils {

	/**
	 * 计算两点间距离
	 * @param p1
	 * @param p2
	 * @return
	 */
	public static final double distance(FInt2 p1,FInt2 p2){
		int x=p1.getX()-p2.getY(),y=p1.getY()-p2.getY();
		return Math.sqrt(x*x+y*y);
	}
	/**
	 * 计算矩形r中心点到p的距离
	 * @param r
	 * @param p
	 * @return
	 * @see #distance(FInt2, FInt2)
	 */
	public static final double distance(FRect r,FInt2 p){
		return distance(new FInt2(r.getLeft()+(r.getWidth()>>1),r.getTop()+(r.getHeight()>>1)),p);
	}
}
